package com.aplink.generic.constant;

import android.text.InputType;

/**
 * @author Le Hien Nguyen.
 * @SeeMore: http://developer.android.com/reference/android/widget/TextView.html#
 * attr_android:inputType
 */
public enum EditTextType {
    NUMBER( "number", InputType.TYPE_CLASS_NUMBER ),
    PHONE(
            "phone",
            InputType.TYPE_CLASS_PHONE ),
    TEXT( "text", InputType.TYPE_CLASS_TEXT ),
    EMAIL(
            "textEmail",
            InputType.TYPE_CLASS_TEXT
                    | InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS ),
    PASSWORD(
            "textPassword",
            InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD );
    // if you have more inputType, please define at here

    private int mValue;
    private String mName;

    public static EditTextType get( String name ) {
        for ( EditTextType inputType : values() ) {
            if ( inputType.mName.equalsIgnoreCase( name ) ) {
                return inputType;
            }
        }
        return null;
    }

    private EditTextType( String name, int value ) {
        this.mValue = value;
        this.mName = name;
    }

    public int getValue() {
        return mValue;
    }

    public void setValue( int value ) {
        mValue = value;
    }

    public String getName() {
        return mName;
    }

    public void setName( String name ) {
        mName = name;
    }

}
